<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:s="http://jboss.com/products/seam/taglib"
	xmlns:m="http://www.ol4jsf.org"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:o="http://openfaces.org/">


	<h:panelGroup id="panelSpatialAnalysisResults">
		<h:panelGroup rendered="#{spatialAnalysisHelper.analysisComplete}">
			<div align="center">
				<h2>ANALISIS ESPACIAL</h2>
				<rich:separator lineType="solid"/>
				<br />

				<ui:include src="/WEB-INF/includes/zoneInfoIncl.xhtml">
					<ui:param name="zone" value="#{spatialAnalysisHelper.spatialZone}" />
					<ui:param name="noZoneMsg" value="No se ha seleccionado ninguna zona" />
					<ui:param name="width" value="50%" />
				</ui:include>

				<br />
				<h:panelGroup rendered="#{spatialAnalysisHelper.ruleGroup != null}">
					<h3>ANALISIS DE REGLAS</h3>
					<rich:separator lineType="solid"/>
					<br />
					<table width="50%" style="text-align: left;">
						<tr>
							<th width="30%">Nombre</th>
							<td width="70%">#{spatialAnalysisHelper.ruleGroup.name}</td>
						</tr>
						<tr>
							<th>Descripcion</th>
							<td>#{spatialAnalysisHelper.ruleGroup.description}</td>
						</tr>
					</table>
					<br />
					<br />
					<ui:repeat var="rule" value="#{spatialAnalysisHelper.ruleGroupRules}" varStatus="idx">
						<rich:separator lineType="solid"/>
						<br />
						<table style="width: 50%; text-align: left;">
							<tr>
								<th width="30%">#{messages['spatial_rules.code']}</th>
								<td width="70%">#{rule.code}</td>
							</tr>
							<tr>
								<th>#{messages['spatial_rules.description']}</th>
								<td>#{rule.description}</td>
							</tr>
						</table>
						<br />
						<h:form>
						<rich:dataTable var="sar" 
							value="#{spatialAnalysisHelper.sarListFromRule(rule)}"
							width="95%" rows="15">
							<rich:column>
								<f:facet name="header">#{messages['spatial_analysis.zone_name']}</f:facet>
								<h:outputText value="#{sar.zoneName}" />
							</rich:column>
							<rich:column>
								<f:facet name="header">#{messages['spatial_analysis.location']}</f:facet>
								<h:outputText value="#{sar.locationInCountry}" />
							</rich:column>
							<rich:column>
								<f:facet name="header">#{messages['spatial_analysis.current_land_use']}</f:facet>
								<h:outputText value="#{sar.landUse}" />
							</rich:column>
							<rich:column>
								<f:facet name="header">#{messages['spatial_analysis.other_land_uses']}</f:facet>
								<h:outputText value="TODO!" />
							</rich:column>
							<rich:column>
								<f:facet name="header">#{messages['spatial_analysis.level']}</f:facet>
								<h:outputText value="#{sar.levelName}" />
							</rich:column>
							<rich:column rendered="#{rule.distanceRule}">
								<f:facet name="header">#{messages['DISTANCE']}</f:facet>
								<h:outputText value="#{sar.distance}" />
							</rich:column>
							<f:facet name="footer">
							</f:facet>
						</rich:dataTable>

						<ui:remove>
							<h:outputText value="dtRuleResult_#{idx}" />
							<rich:datascroller maxPages="15" for="dtRuleResult_#{idx}"/>
						</ui:remove>
						
						</h:form>
						<br />
						<br />
					</ui:repeat>
				</h:panelGroup>
				<br />
				<h3>INTERACCIONES ESPACIALES</h3>
				<rich:separator lineType="solid"/>
				<br />
				
				<ui:include src="spatialAnalysisContentInteractionsIncl.xhtml" />

			</div>
		</h:panelGroup>
	</h:panelGroup>
	
</ui:composition>
